<h1>Listing products</h1>

<table>
  <tr>
    <th>Name</th>
    <th>Price</th>
    <th>Description</th>
    <th>Restaurant</th>
    <th>Category</th>
    <th>Created by</th>
  </tr>

<% for product in @products %>
  <tr>
    <td><%= link_to h(product.name), product %></td>
    <td><%= product.price %></td>
    <td><%= h(product.description) %></td>
    <td><%= link_to h(product.restaurant.name), product.restaurant %></td>
    <td><%= link_to h(product.product_category.name), product.product_category %></td>
    <td><%= link_to h(product.user.login), product.user if product.user %></td>
    <td><%= link_to 'Edit', edit_product_path(product) %></td>
    <td><%= link_to 'Destroy', product, :confirm => 'Are you sure?', :method => :delete %></td>
  </tr>
<% end %>
</table>

<br />

<%= link_to 'New product', new_product_path %> |
<%= link_to 'New category', new_product_category_path %>